package com.leilei.controller;

import com.google.gson.Gson;
import com.leilei.dao.impl.HisShoppingCustomServiceImpl;
import com.leilei.entity.CommodityVersion;
import com.leilei.entity.HisShoppingCustom;
import com.leilei.entity.User;
import com.leilei.service.IHisShoppingCustomService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;

@WebServlet("/HisShoppingCustomServlet")
public class HisShoppingCustomServlet extends BaseServlet{

    private IHisShoppingCustomService hisShoppingCustomService = new HisShoppingCustomServiceImpl();

    public HisShoppingCustomServlet(){

    }

    protected void getUserHisShoppingCustom(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        HttpSession session = req.getSession();

        User user = (User) session.getAttribute("user");

        List<HisShoppingCustom> hisShoppingCustoms =
                hisShoppingCustomService.selectUserHisShoppingCustom(user.getUid());

        req.setAttribute("hisList", hisShoppingCustoms);

        req.getRequestDispatcher("jsp/hisShoppingCustoms.jsp").forward(req, resp);
    }

}
